package com.pi2e.view.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import butterknife.Bind;
import butterknife.BindColor;
import butterknife.BindString;
import butterknife.ButterKnife;

import com.pi2e.R;
import com.pi2e.view.base.BaseActivity;
import com.pi2e.view.common.HeaderView;

/**
 * @ClassName: LoginActivity
 * @Description: TODO(登录)
 * @author luotao
 * @date 2016年9月27日 上午11:38:09
 *
 */
public class LoginActivity extends BaseActivity implements OnClickListener {
	@Bind(R.id.et_pwd)
	public EditText edt_pwd;
	@Bind(R.id.btn_ok)
	public Button btn_ok;

	@BindColor(R.color.while_FFFFFF)
	int etHintCo;
	@BindString(R.string.title_sayhello_text)
	String welcomeContent;
	/***/
	String flags;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		flags = getIntent().getStringExtra("MainActivityFlag");

	}

	public void initView() {
		// TODO Auto-generated method stub
		edt_pwd.setHintTextColor(etHintCo);
		btn_ok.setOnClickListener(this);
	}

	@Override
	public HeaderView initHeaderView() {
		// TODO Auto-generated method stub
		HeaderView hv = new HeaderView(findViewById(R.id.headId), this);
		hv.getTitle_Tv().setText(welcomeContent);
		return hv;
	}

	@Override
	public void setContentView() {
		setContentView(R.layout.activity_login);
		ButterKnife.bind(this);
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		int id = v.getId();
		switch (id) {
		case R.id.btn_ok:
			startActivityByFlag(flags);
			break;

		default:
			break;
		}
	}

	@Override
	public void initFootView() {
		// TODO Auto-generated method stub

	}

	public void startActivityByFlag(String flags) {
		Intent it = null;
		switch (flags) {
		case "VIP":
			it = new Intent(LoginActivity.this, VipActivity.class);

			break;
		case "NETSET":
			it = new Intent(LoginActivity.this, SettingActivity.class);
			break;
		case "RoomNum":
			it = new Intent(LoginActivity.this, RoomNumActivity.class);
			break;
		case "Welcom":
			it = new Intent(LoginActivity.this, StartReceCustomer.class);
			it.putExtra("FLAG", "Welcome") ;
			break;
		}
		if (null != it) {
			startActivity(it);
		}
		
		finish(); 
	}

}
